﻿using Chloe.Infrastructure;
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace ChloeEx.Core
{
    /// <summary>
    /// 
    /// </summary>
    /// <param name="connectionstring">连接字符串</param>
    /// <returns></returns>
    public delegate IDbConnection CreateConnectionHandler(string connectionstring);
    public class ConnectionFactory : IDbConnectionFactory
    {
        private CreateConnectionHandler createConnectionHandler;
        public ConnectionFactory(CreateConnectionHandler createhandler)
        {
            createConnectionHandler = createhandler;
        }
        public IDbConnection CreateConnection()
        {
            return createConnectionHandler(Setting.Instance.ConnectionString);
        }
    }
}
